@extends("d.layout.index")
@section("con")
<div class="mws-panel grid_8">
	<div class="mws-panel-header">
    	<span>广告版块添加</span>
    </div>
    <div class="mws-panel-body no-padding">
    	<form class="mws-form" action="/admin/adver/insert" method="post" enctype="multipart/form-data">
    	{{csrf_field()}}
    		<div class="mws-form-inline">
    			<div class="mws-form-row">
    				<label class="mws-form-label">名称</label>
    				<div class="mws-form-item">
    					<input name="name" class="small" type="text">
    				</div>
    			</div>
                <div class="mws-form-row">
                    <label class="mws-form-label">序号</label>
                    <div class="mws-form-item">
                        <input name="order" class="small" type="text">
                    </div>
                </div>
    			<div class="mws-form-row">
    				<label class="mws-form-label">图片</label>
    				<div class="mws-form-item">
    					<input name="pic" type="file" onchange="getImg(this)">
    					<span id="sp">（建议尺寸：256×336）</span>
    				</div>
    			</div>
                <div id="d"></div>
                <div class="mws-form-row">
                    <label class="mws-form-label">描述</label>
                    <div class="mws-form-item">
                    <script id="editor" type="text/plain" style="width:450px;height:300px;"></script>
                    </div>
                </div>
	    		<div class="mws-button-row">
	    			<input value="提交" class="btn btn-danger" type="submit">
	    			<input value="重置" class="btn " type="reset">
	    		</div>
	    	</div>
    	</form>
        <script type="text/javascript" charset="utf-8" src="/adm/editer/ueditor.config.js"></script>
        <script type="text/javascript" charset="utf-8" src="/adm/editer/ueditor.all.min.js"> </script>
        <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
        <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
        <script type="text/javascript" charset="utf-8" src="/adm/editer/lang/zh-cn/zh-cn.js"></script>

       
    	<script type="text/javascript">
        var ue = UE.getEditor('editor');
    	function getImg(file){
			  var prevDiv = document.getElementById('d');
                if (file.files && file.files[0])  
                {  
                    var reader = new FileReader(); 
                    reader.onload = function(evt){  
                        prevDiv.innerHTML = '<img src="' + evt.target.result + '" />';  
                    }    
                    reader.readAsDataURL(file.files[0]);  
                }else{  
                    prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';  
                }  
		}
    	</script>
    </div>    	
</div>
@endsection